import $http  from '@/utils/http';
import $toast from '@/utils/toast';

/**
 * 个人中心--关注的店铺
 * @param {[type]} uid 用户id
 * @return Promise
 */

export function followShopInfo( uid )
{
	return $http.post('', { module:"Personalcenter#followShopInfo", uid });
}



/**
 * 个人中心--关注的店铺-删除
 * @param {[type]} uid    用户id
 * @param {[type]} log_id 店铺id
 * @return Promise
 */

export function delShop(uid,log_id )
{
	return $http.post('', { module:"Personalcenter#deleteFollowShopInfo",uid,log_id });
}



/**
 * 店铺信息
 * @param  {[type]} shop_id 店铺ID
 * @return Promise
 */
export function getShopinfo(shop_id)
{
	if(!shop_id)
		return new Promise ( () => $toast('SHOPID 不能为空'))

	return $http.post('',{ module:'Shop#shopinfo',shop_id })
}

/**
 * 店铺列表
 * @param  {[type]} options.shop_id    店铺id
 * @param  {[type]} options.type       类型 0：首页 1：体验 2：预购 3：在售
 * @param  {[type]} options.page_index 页数
 * @param  {[type]} options.page_size  条数
 * @return Promise
 */
export function getShopList({ shop_id, type, page_index, page_size })
{
	if(!shop_id)
		return new Promise ( () => $toast('SHOPID 不能为空'))

	if(!type)
		return new Promise ( () => $toast('TYPE 不能为空'))

	return $http.post('',{ module:'Shop#goodslist',shop_id, type, page_index, page_size })
}


/**
 * 店铺banner
 * @param  {[type]} shop_id 店铺id
 * @return Promise
 */
export function getShopBanner(shop_id)
{
	if(!shop_id)
		return new Promise ( () => $toast('SHOPID 不能为空'))

	return $http.post('',{ module:'Shop#shop_banner',shop_id })
}

